<!DOCTYPE html>
<html lang="en-US" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>RsCode</title>
    <meta name="description" content="开箱即用的.net工具库，助力.net开发">
    <meta name="generator" content="VitePress v1.0.2">
    <link rel="preload stylesheet" href="/assets/style.BsBCFzMC.css" as="style">
    
    <script type="module" src="/assets/app.CqgVlO9t.js"></script>
    <link rel="preload" href="/assets/inter-roman-latin.Bu8hRsVA.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/assets/chunks/framework.CI8or701.js">
    <link rel="modulepreload" href="/assets/chunks/theme.B2CONEdC.js">
    <link rel="modulepreload" href="/assets/index.md.CkFGx4o6.lean.js">
    <link rel="shortcut icon" href="/assets/images/favicon.ico">
    <script>var _hmt=_hmt||[];let hm=document.createElement("script");hm.src="https://hm.baidu.com/hm.js?5c52154150152a6045bd8c1d5a2b3122";let s=document.getElementsByTagName("script")[0];hm.id="bd",s.parentNode.insertBefore(hm,s);</script>
    <script src="https://lf-cdn.coze.cn/obj/unpkg/flow-platform/chat-app-sdk/0.1.0-beta.5/libs/cn/index.js" type="text/javascript"></script>
    <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
    <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-5d98c3a5><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0f60ec36></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0f60ec36> Skip to content </a><!--]--><!----><header class="VPNav" data-v-5d98c3a5 data-v-ae24b3ad><div class="VPNavBar home top" data-v-ae24b3ad data-v-ccf7ddec><div class="wrapper" data-v-ccf7ddec><div class="container" data-v-ccf7ddec><div class="title" data-v-ccf7ddec><div class="VPNavBarTitle" data-v-ccf7ddec data-v-ab179fa1><a class="title" href="/" data-v-ab179fa1><!--[--><!--]--><!----><span data-v-ab179fa1>RsCode</span><!--[--><!--]--></a></div></div><div class="content" data-v-ccf7ddec><div class="content-body" data-v-ccf7ddec><!--[--><!--]--><div class="VPNavBarSearch search" data-v-ccf7ddec><!--[--><!----><div id="local-search"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><span class="vp-icon DocSearch-Search-Icon"></span><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key"></kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div><!--]--></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-ccf7ddec data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-b6c34ac9><span class="text" data-v-b6c34ac9><!----><span data-v-b6c34ac9>RsCode助手</span><span class="vpi-chevron-down text-icon" data-v-b6c34ac9></span></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/rscode/config.html" data-v-43f1e123><!--[-->基础配置<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/rscode/utils.html" data-v-43f1e123><!--[-->常用代码<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/rscode/appsettings.html" data-v-43f1e123><!--[-->appsettings<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/rscode/db/database.html" data-v-43f1e123><!--[-->数据库操作<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/rscode/security/security.html" data-v-43f1e123><!--[-->数据安全<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/rscode/storage/demo.html" data-v-43f1e123><!--[-->存储示例<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/rscode/plugins.html" data-v-43f1e123><!--[-->插件开发<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-b6c34ac9><span class="text" data-v-b6c34ac9><!----><span data-v-b6c34ac9>第三方平台SDK</span><span class="vpi-chevron-down text-icon" data-v-b6c34ac9></span></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/payment/readme.html" data-v-43f1e123><!--[-->支付平台SDK<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/wx/readme.html" data-v-43f1e123><!--[-->微信平台SDK<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link" href="/douyin/readme.html" data-v-43f1e123><!--[-->抖音平台SDK<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><a class="VPLink link vp-external-link-icon VPNavBarMenuLink" href="https://kefu.rs888.net" target="_blank" rel="noreferrer" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>智能客服系统</span><!--]--></a><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-b6c34ac9><span class="text" data-v-b6c34ac9><!----><span data-v-b6c34ac9>AI工具箱</span><span class="vpi-chevron-down text-icon" data-v-b6c34ac9></span></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="https://api.rs888.net/app/index.html" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->AI工具箱在线版<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-e7ea1737 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="https://pan.baidu.com/s/1flQwaG1rWf0-Ea6ZvvS74Q?pwd=zfj1" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->AI工具箱window版<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-ccf7ddec data-v-e6aabb21><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-e6aabb21 data-v-d1f28634 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-d1f28634></span><span class="vpi-moon moon" data-v-d1f28634></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-ccf7ddec data-v-0394ad82 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/kuiyu/RsCode" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-eee4e7cb><span class="vpi-social-github" /></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-ccf7ddec data-v-d0bd9dde data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-b6c34ac9><span class="vpi-more-horizontal icon" data-v-b6c34ac9></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><!----><!--[--><!--[--><!----><div class="group" data-v-d0bd9dde><div class="item appearance" data-v-d0bd9dde><p class="label" data-v-d0bd9dde>Appearance</p><div class="appearance-action" data-v-d0bd9dde><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-d0bd9dde data-v-d1f28634 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-d1f28634></span><span class="vpi-moon moon" data-v-d1f28634></span><!--]--></span></span></button></div></div></div><div class="group" data-v-d0bd9dde><div class="item social-links" data-v-d0bd9dde><div class="VPSocialLinks social-links-list" data-v-d0bd9dde data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/kuiyu/RsCode" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-eee4e7cb><span class="vpi-social-github" /></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-ccf7ddec data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-ccf7ddec><div class="divider-line" data-v-ccf7ddec></div></div></div><!----></header><!----><!----><div class="VPContent is-home" id="VPContent" data-v-5d98c3a5 data-v-1428d186><div class="VPHome" data-v-1428d186 data-v-686f80a6><!--[--><!--]--><div class="VPHero has-image VPHomeHero" data-v-686f80a6 data-v-303bb580><div class="container" data-v-303bb580><div class="main" data-v-303bb580><!--[--><!--]--><!--[--><h1 class="name" data-v-303bb580><span class="clip" data-v-303bb580>RsCode</span></h1><p class="text" data-v-303bb580>开箱即用的.net工具库</p><p class="tagline" data-v-303bb580>开源代码库技术文档</p><!--]--><!--[--><!--]--><div class="actions" data-v-303bb580><!--[--><div class="action" data-v-303bb580><a class="VPButton medium brand" href="/rscode/guide/getting-started.html" data-v-303bb580 data-v-cad61b99>查看文档</a></div><div class="action" data-v-303bb580><a class="VPButton medium alt" href="https://github.com/kuiyu/rscode" target="_blank" rel="noreferrer" data-v-303bb580 data-v-cad61b99>查看源码</a></div><!--]--></div><!--[--><!--]--></div><div class="image" data-v-303bb580><div class="image-container" data-v-303bb580><div class="image-bg" data-v-303bb580></div><!--[--><!--[--><img class="VPImage image-src" src="/assets/logo-w.svg" alt data-v-8426fc1a><!--]--><!--]--></div></div></div></div><!--[--><!--]--><!--[--><!--]--><div class="VPFeatures VPHomeFeatures" data-v-686f80a6 data-v-a6181336><div class="container" data-v-a6181336><div class="items" data-v-a6181336><!--[--><div class="grid-3 item" data-v-a6181336><div class="VPLink no-icon VPFeature" data-v-a6181336 data-v-a3976bdc><!--[--><article class="box" data-v-a3976bdc><div class="icon" data-v-a3976bdc>🛠️</div><h2 class="title" data-v-a3976bdc>高效</h2><p class="details" data-v-a3976bdc>开箱即用</p><!----></article><!--]--></div></div><div class="grid-3 item" data-v-a6181336><div class="VPLink no-icon VPFeature" data-v-a6181336 data-v-a3976bdc><!--[--><article class="box" data-v-a3976bdc><div class="icon" data-v-a3976bdc>⚡</div><h2 class="title" data-v-a3976bdc>开源</h2><p class="details" data-v-a3976bdc>遵守MIT协议 100%公开源码</p><!----></article><!--]--></div></div><div class="grid-3 item" data-v-a6181336><div class="VPLink no-icon VPFeature" data-v-a6181336 data-v-a3976bdc><!--[--><article class="box" data-v-a3976bdc><div class="icon" data-v-a3976bdc>⭐</div><h2 class="title" data-v-a3976bdc>免费</h2><p class="details" data-v-a3976bdc>完全免费使用</p><!----></article><!--]--></div></div><!--]--></div></div></div><!--[--><!--]--><div class="vp-doc container" style="--vp-offset:calc(50% - Infinitypx);" data-v-686f80a6 data-v-82d4af08><!--[--><div style="position:relative;" data-v-686f80a6><div><p><code>RsCode</code>是快速开发.net应用的工具库,其丰富的功能和易用性，能够显著提高.net开发的效率和质量</p><h2 id="✨-特性" tabindex="-1">✨ 特性 <a class="header-anchor" href="#✨-特性" aria-label="Permalink to &quot;✨ 特性&quot;">​</a></h2><ul><li><p>🌈 MIT开源协议，完全免费使用</p></li><li><p>📦 开箱即用</p></li><li><p>💕 集成一些流行的开源框架/库。</p></li><li><p>🎨 集成第三方平台业务API，例：微信开发，第三方支付，第三方存储,抖音相关开发SDK等</p></li></ul><h2 id="💿-当前版本" tabindex="-1">💿 当前版本 <a class="header-anchor" href="#💿-当前版本" aria-label="Permalink to &quot;💿 当前版本&quot;">​</a></h2><ul><li>正式发布: RsCode<a href="https://www.nuget.org/packages/RsCode/" target="_blank" rel="noreferrer"><img src="https://img.shields.io/nuget/v/RsCode.svg?color=red&amp;style=flat-square" alt="RsCode"></a> RsCode.AspNetCore<a href="https://www.nuget.org/packages/RsCode.AspNetCore/" target="_blank" rel="noreferrer"><img src="https://img.shields.io/nuget/v/RsCode.AspNetCore.svg?color=red&amp;style=flat-square" alt="RsCode.AspNetCore"></a></li><li>开源协议: <a href="https://github.com/kuiyu/RsCode/blob/master/LICENSE" target="_blank" rel="noreferrer"><img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="RsCode"></a></li></ul><h2 id="🖥-支持环境" tabindex="-1">🖥 支持环境 <a class="header-anchor" href="#🖥-支持环境" aria-label="Permalink to &quot;🖥 支持环境&quot;">​</a></h2><ul><li>.NET Core 6.0以上</li></ul><h2 id="快速使用" tabindex="-1">快速使用 <a class="header-anchor" href="#快速使用" aria-label="Permalink to &quot;快速使用&quot;">​</a></h2><blockquote><p>推荐使用 Visual Studio 2022 开发。</p></blockquote><ul><li><p>进入应用的项目文件夹，安装 Nuget 包引用</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">$</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dotnet</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> add</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> package</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> RsCode</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --version</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2.3.1</span></span></code></pre></div></li><li><p>asp.net core项目引用:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">Install-Package</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> RsCode.AspNetCore</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -Version</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2.3.2</span></span></code></pre></div></li><li><p>引入<a href="https://rscode.cn/rscode/log.html#%E9%99%84%E5%BD%951" target="_blank" rel="noreferrer">log4net配置</a></p></li><li><p><code>Pragram.cs</code>中添加即可</p></li></ul><div class="language-csharp vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">csharp</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> using</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RsCode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> using</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RsCode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AspNetCore</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> using</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> AspectCore</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">Extensions</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">DependencyInjection</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> var</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> builder</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> WebApplication.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">CreateBuilder</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(args);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.Host.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseServiceProviderFactory</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> DynamicProxyServiceProviderFactory</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">());</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.Services.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AddControllers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">().</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AddControllersAsServices</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> //添加RsCode</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.Services.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AddRsCode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> //自动注册应用接口和实现</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[] </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">assemblies</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> new</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[] { </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;your.project.Core&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;应用程序集名称&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }; </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">//todo 替换成实际业务类程序集名称</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.Services.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AutoInject</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(assemblies); </span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> //添加数据库，以MySql为例</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.Services.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AddDatabase</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(FreeSql.DataType.MySql, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;DefaultConnection&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> //添加unitofwork</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.Services.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AddUnitOfWork</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> //添加插件支持</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.Services.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">AddPlugins</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> var</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> app</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> builder.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">Build</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (app.Environment.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">IsDevelopment</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">())</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> 	//启用swaggerui api文档</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">     app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseSwagger</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">     app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseSwaggerUI</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseHttpsRedirection</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseStaticFiles</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseAuthorization</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> //异常处理</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseErrorHandler</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> //添加插件支持</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UsePlugins</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(builder.Environment);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">UseEndpoints</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">endpoints</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =&gt;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">     endpoints.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">MapControllerRoute</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">         name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;areas&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">         pattern</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;{area:exists}/{controller=Home}/{action=Index}/{id?}&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">     endpoints.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">MapControllerRoute</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">         name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;default&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">         pattern</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;{controller=Home}/{action=Index}/{id?}&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> app.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">Run</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>功能包含：API统一消息，工作单元，日志，数据库操作，接口自动注入，异常拦截，模型验证，mediator中间件，内存缓存，id生成器;更多实用的功能正在持续加入中</p></div><p>​</p><h2 id="🤝-如何贡献" tabindex="-1">🤝 如何贡献 <a class="header-anchor" href="#🤝-如何贡献" aria-label="Permalink to &quot;🤝 如何贡献&quot;">​</a></h2><p><a href="https://gitee.com/kuiyu/RsCode/pulls" target="_blank" rel="noreferrer"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome"></a></p><p>如果你希望参与贡献，欢迎 <a href="https://gitee.com/kuiyu/RsCode/issues" target="_blank" rel="noreferrer">Pull Request</a>，或给我们 <a href="https://gitee.com/kuiyu/RsCode/issues" target="_blank" rel="noreferrer">报告 Bug</a> 。</p><h2 id="❓-社区互助" tabindex="-1">❓ 社区互助 <a class="header-anchor" href="#❓-社区互助" aria-label="Permalink to &quot;❓ 社区互助&quot;">​</a></h2><p>如果您在使用的过程中碰到问题，可以通过以下途径寻求帮助，同时我们也鼓励资深用户通过下面的途径给新人提供帮助。</p><ul><li><p><a href="https://gitee.com/kuiyu/RsCode/issues" target="_blank" rel="noreferrer">gitee</a></p></li><li><p>技术人互动,加好友,聊聊技术变现(微信)<br><img src="https://rscode.cn/assets/images/friend.jpg" width="300" alt="技术变现"></p></li></ul></div></div><!--]--></div></div></div><footer class="VPFooter" data-v-5d98c3a5 data-v-e315a0ad><div class="container" data-v-e315a0ad><!----><p class="copyright" data-v-e315a0ad>Copyright © 2024 软商网络 <a target="_blank" href="https://beian.miit.gov.cn">豫ICP备16037953号</a></p></div></footer><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"jyb_guide.md\":\"DdeHSQa_\",\"douyin_readme.md\":\"CeVYCJkJ\",\"jyb_tg.md\":\"DIMD3G6n\",\"rscode_idempotency.md\":\"BCuFu7zf\",\"rscode_channel.md\":\"CtvqTjcG\",\"rscode_cache.md\":\"BtMDde75\",\"markdown-examples.md\":\"DmCL8fCN\",\"rscode_ioc.md\":\"CMW8DqoL\",\"index.md\":\"CkFGx4o6\",\"api-examples.md\":\"By2HohfZ\",\"payment_readme.md\":\"Bh66Imlv\",\"rscode_exception.md\":\"Ur1ZvVXt\",\"rscms_readme.md\":\"BV7UHPgU\",\"jyb_cashier.md\":\"BGOorq9a\",\"rscode_dto.md\":\"B1Qn0tdA\",\"rscode_security_security.md\":\"BUYuvAfO\",\"rscode_security_authcode.md\":\"Cwl75UX4\",\"wx_auth.md\":\"D_NlN2IC\",\"rscode_db_database.md\":\"GfjDpcHv\",\"wx_api.md\":\"CuZp59nd\",\"wx_accesstoken.md\":\"t__AmYpa\",\"rscode_utils_httphelper.md\":\"C80zV9XA\",\"wx_custom-menu.md\":\"ChD1P1iU\",\"rscode_schedulejob.md\":\"DqLS4rjr\",\"wx_kf-wx.md\":\"DYsAsZkJ\",\"wx_kf-mp.md\":\"BZYw5m6v\",\"wx_readme.md\":\"BoqLLqNV\",\"rscode_mcp.md\":\"CxoWEXPB\",\"rscode_log.md\":\"Cvx7Xgim\",\"wx_third-platform.md\":\"CnL8Ykfp\",\"jyb_doc.md\":\"BB7uock3\",\"rscode_guide_readme.md\":\"BgqUeEnU\",\"rscode_msg-formater.md\":\"BpHiWFfZ\",\"rscode_config.md\":\"Dm_KqgID\",\"wx_question.md\":\"Ck904xbU\",\"rscode_guide_change-log.md\":\"C1gMvP61\",\"jyb_readme.md\":\"CbVY2Kv_\",\"rscode_db_freesql.md\":\"n5O0epoo\",\"rscode_storage_local.md\":\"Ch63lc9g\",\"rscode_storage_config.md\":\"C_sh5KtB\",\"rscode_sse.md\":\"d2lJ4eON\",\"wx_qrcode.md\":\"BjFy22x5\",\"wx_init-sdk.md\":\"2VChfh0B\",\"rscode_webapi.md\":\"DaUniwIT\",\"wx_users.md\":\"D0eYi_rS\",\"rscode_utils_xmlhelper.md\":\"CaQZo6mI\",\"rscode_security_cors.md\":\"B5Htbo9g\",\"rscode_utils.md\":\"D2AyQEZz\",\"wx_uniapp-mp-login.md\":\"CQ2OGPIQ\",\"rscode_domain-event.md\":\"BBapd6C0\",\"rscode_guide_getting-started.md\":\"D1T5hkf_\",\"rscode_plugins.md\":\"B3IRA5PX\",\"wx_event-message.md\":\"BL55-N05\",\"rscode_db_unitofwork.md\":\"DCawEvps\",\"rscode_storage_qiniu-api.md\":\"Cy8L0Jmy\",\"rscode_db_petapoco.md\":\"CqiunFi4\",\"wx_js跳转至微信小程序.md\":\"Cnn9O8E6\",\"rscode_i18n.md\":\"Cip0QmIe\",\"rscode_filter.md\":\"FkeeR6QX\",\"rscode_appsettings.md\":\"kMW74ww1\",\"wx_rscode-wechat-helper.md\":\"CHdMoxX0\",\"rscode_validate.md\":\"DBcyaj3d\",\"rscode_storage_demo.md\":\"BEeYaEor\",\"rscode_security_auth.md\":\"DTKZJ_1Q\",\"rscode_threads.md\":\"Dz7_3iL4\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"RsCode\",\"description\":\"开箱即用的.net工具库，助力.net开发\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"outline\":\"deep\",\"outlineTitle\":\"大纲\",\"nav\":[{\"text\":\"RsCode助手\",\"items\":[{\"text\":\"基础配置\",\"link\":\"/rscode/config.md\"},{\"text\":\"常用代码\",\"link\":\"/rscode/utils.md\"},{\"text\":\"appsettings\",\"link\":\"/rscode/appsettings.md\"},{\"text\":\"数据库操作\",\"link\":\"/rscode/db/database.md\"},{\"text\":\"数据安全\",\"link\":\"/rscode/security/security.md\"},{\"text\":\"存储示例\",\"link\":\"/rscode/storage/demo.md\"},{\"text\":\"插件开发\",\"link\":\"/rscode/plugins.md\"}]},{\"text\":\"第三方平台SDK\",\"items\":[{\"text\":\"支付平台SDK\",\"link\":\"/payment/readme.md\"},{\"text\":\"微信平台SDK\",\"link\":\"/wx/readme.md\"},{\"text\":\"抖音平台SDK\",\"link\":\"/douyin/readme.md\"}]},{\"text\":\"智能客服系统\",\"link\":\"https://kefu.rs888.net\"},{\"text\":\"AI工具箱\",\"items\":[{\"text\":\"AI工具箱在线版\",\"link\":\"https://api.rs888.net/app/index.html\"},{\"text\":\"AI工具箱window版\",\"link\":\"https://pan.baidu.com/s/1flQwaG1rWf0-Ea6ZvvS74Q?pwd=zfj1\"}]}],\"sidebar\":{\"/\":[{\"text\":\"热门功能\",\"items\":[{\"text\":\"appsettings\",\"link\":\"/rscode/appsettings.md\"},{\"text\":\"日志管理\",\"link\":\"/rscode/log.md\"},{\"text\":\"依赖注入\",\"link\":\"/rscode/Ioc.md\"},{\"text\":\"数据传输\",\"link\":\"/rscode/dto.md\"},{\"text\":\"数据格式\",\"link\":\"/rscode/msg-formater.md\"},{\"text\":\"数据验证\",\"link\":\"/rscode/validate.md\"},{\"text\":\"数据缓存\",\"link\":\"/rscode/cache.md\"},{\"text\":\"异常处理\",\"link\":\"/rscode/exception.md\"},{\"text\":\"文档生成\",\"link\":\"/rscode/webapi.md\"},{\"text\":\"线程操作\",\"link\":\"/rscode/threads.md\"},{\"text\":\"计划任务\",\"link\":\"/rscode/ScheduleJob.md\"},{\"text\":\"插件管理\",\"link\":\"/rscode/plugins.md\"},{\"text\":\"常用代码\",\"link\":\"/rscode/utils.md\"},{\"text\":\"过滤器\",\"link\":\"/rscode/filter.md\"},{\"text\":\"SSE\",\"link\":\"/rscode/sse.md\"},{\"text\":\"国际化\",\"link\":\"/rscode/i18n.md\"}]},{\"text\":\"数据库\",\"items\":[{\"text\":\"数据库配置\",\"link\":\"/rscode/db/database.md\"},{\"text\":\"UnitOfWork\",\"link\":\"/rscode/db/unitofwork.md\"},{\"text\":\"FreeSql说明\",\"link\":\"/rscode/db/freesql.md\"}]},{\"text\":\"对象存储\",\"items\":[{\"text\":\"存储示例\",\"link\":\"/rscode/storage/demo.md\"},{\"text\":\"参数配置\",\"link\":\"/rscode/storage/config.md\"},{\"text\":\"本地存储\",\"link\":\"/rscode/storage/local.md\"},{\"text\":\"七牛存储\",\"link\":\"/rscode/storage/qiniu-api.md\"}]},{\"text\":\"安全认证\",\"items\":[{\"text\":\"认证授权\",\"link\":\"/rscode/security/auth.md\"},{\"text\":\"数据安全\",\"link\":\"/rscode/security/security.md\"},{\"text\":\"跨域设置\",\"link\":\"/rscode/security/cors.md\"},{\"text\":\"验证码\",\"link\":\"/rscode/security/authcode.md\"}]}],\"/rscode/guide/\":[{\"text\":\"开始\",\"items\":[{\"text\":\"快速入门\",\"link\":\"/rscode/guide/getting-started.md\"},{\"text\":\"数据库配置\",\"link\":\"/rscode/db/database.md\"},{\"text\":\"日志管理\",\"link\":\"/rscode/guide/change-log.md\"}]}],\"/jyb/\":[{\"text\":\"交易宝系统\",\"items\":[{\"text\":\"交易宝简介\",\"link\":\"/jyb/readme.md\"},{\"text\":\"快速使用\",\"link\":\"/jyb/doc.md\"},{\"text\":\"分享有赏\",\"link\":\"/jyb/tg.md\"}]}],\"/wx/\":[{\"text\":\"微信SDK\",\"items\":[{\"text\":\"SDK简介\",\"link\":\"/wx/readme.md\"},{\"text\":\"初始化SDK\",\"link\":\"/wx/init-sdk.md\"},{\"text\":\"微信token管理\",\"link\":\"/wx/accesstoken.md\"},{\"text\":\"事件与消息\",\"link\":\"/wx/event-message.md\"},{\"text\":\"二维码\",\"link\":\"/wx/qrcode.md\"},{\"text\":\"js跳转至微信小程序\",\"link\":\"/wx/js跳转至微信小程序.md\"},{\"text\":\"WechatHelper\",\"link\":\"/wx/RsCode-Wechat-Helper.md\"},{\"text\":\"小程序客服消息\",\"link\":\"/wx/kf-mp.md\"},{\"text\":\"公众号客服消息\",\"link\":\"/wx/kf-wx.md\"},{\"text\":\"公众号菜单\",\"link\":\"/wx/custom-menu.md\"},{\"text\":\"微信用户授权\",\"link\":\"/wx/users.md\"},{\"text\":\"uniapp小程序登录\",\"link\":\"/wx/uniapp-mp-login.md\"},{\"text\":\"微信API\",\"link\":\"/wx/api.md\"},{\"text\":\"微信认证\",\"link\":\"/wx/auth.md\"},{\"text\":\"第三方平台API\",\"link\":\"/wx/third-platform.md\"},{\"text\":\"常见问题\",\"link\":\"/wx/question.md\"}]}]},\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/kuiyu/RsCode\"}],\"search\":{\"provider\":\"local\",\"options\":{\"locales\":{\"zh\":{\"translations\":{\"button\":{\"buttonText\":\"搜索\",\"buttonAriaLabel\":\"搜索\"}}}}}},\"lastUpdatedText\":\"更新时间\",\"lastUpdated\":{\"text\":\"最后一次更新\",\"formatOptions\":{\"dateStyle\":\"full\",\"timeStyle\":\"medium\"}},\"docFooter\":{\"prev\":\"上一页\",\"next\":\"下一页\"},\"footer\":{\"message\":\"\",\"copyright\":\"Copyright © 2024 软商网络 <a target=\\\"_blank\\\" href=\\\"https://beian.miit.gov.cn\\\">豫ICP备16037953号</a>\"}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
    
  </body>
</html>